Learn R Programming

disto (version 0.2.0)

`[.disto`: Extract from a disto object in matrix style extraction

Description

Extract a disto object in matrix style extraction and via direct indexing. 'product' specification allows both outer (matrix output, default option) and inner (vector) product type extraction. For dist backend see: dist_extract.

Usage

# S3 method for disto
[(x, i, j, k, product = "outer")

Arguments

x

object of class 'disto'

i

(integer vector) row indexes

j

(integer vector) column indexes

k

(integer vector) direct indexes

product

(string) One among: "inner", "outer"

Value

When product is 'outer', returns a matrix. Else, a vector.

Examples

Run this code
# NOT RUN {
temp <- stats::dist(iris[,1:4])
dio <- disto(objectname = "temp")
dio
names(dio) <- paste0("a", 1:150)

dio[1, 2]
dio[2, 1]
dio[c("a1", "a10"), c("a5", "a72")]
dio[c("a1", "a10"), c("a5", "a72"), product = "inner"]
dio[k = c(1,3,5)]
# }

Run the code above in your browser using DataLab